package com.flextribe.net
{
	import flash.external.ExternalInterface;
	import flash.utils.flash_proxy;
	
	use namespace flash_proxy;
	
	public dynamic class JavaScriptService extends FlexTribeService 
	{
		
		private var _destination:String;
		
		public function JavaScriptService(destination:String = "")
		{
			_destination = destination;
		}
		
		public function get destination():String{
			return _destination;
		}
		public function set destination(value:String):void{
			_destination = value;
		}
		
		override flash_proxy function callProperty(name:*, ... args:Array):*
	    {
	        return ExternalInterface.call(_destination + (_destination != "" ? "." : "") + name, args);
	    }
		

	}
}